package cn.com.surker.lab.service.impl;

import cn.com.surker.enums.StateEnum;
import cn.com.surker.lab.entity.LabExpendBatch;
import cn.com.surker.lab.dao.LabExpendBatchDao;
import cn.com.surker.lab.vo.LabExpendBatchVo;
import cn.com.surker.lab.service.LabExpendBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 工控机消耗盘表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2024-11-05
 */
public abstract class LabExpendBatchBaseImpl extends ServiceImpl<LabExpendBatchDao, LabExpendBatch> implements LabExpendBatchService {

	@Resource
	protected LabExpendBatchDao labExpendBatchDao;

	@Override
	public List<LabExpendBatch> queryByInv(Long invoiceId, Long lineId, String conBatchId) {
		QueryWrapper<LabExpendBatch> qw = new QueryWrapper<>();
		qw.eq("status", StateEnum.ENABLED.getCode());
		if (invoiceId != null) {
			qw.eq("invoice_id", invoiceId);
		}
		if (lineId != null) {
			qw.eq("line_id", lineId);
		}
		if (conBatchId != null) {
			qw.eq("con_batch_id", conBatchId);
		}
		List<LabExpendBatch> batchList = labExpendBatchDao.selectList(qw);
		return batchList;
	}

	@Override
	public List<LabExpendBatchVo> queryDetailByInv(String dbCode, Long invoiceId) {
		if (invoiceId == null) {
			return null;
		}
		List<LabExpendBatchVo> expendBatchDetailList = labExpendBatchDao.queryDetailByInv(dbCode, invoiceId);
		return expendBatchDetailList;
	}


	@Override
	public List<LabExpendBatchVo> queryDetailByInvB(String dbCode, Long invoiceId) {
		if (invoiceId == null) {
			return null;
		}
		List<LabExpendBatchVo> expendBatchDetailList = labExpendBatchDao.queryDetailByInvB(dbCode, invoiceId);
		return expendBatchDetailList;
	}
}